//
//  MYIHomeHeaderCollectionViewCell.m
//  MaYi
//
//  Created by 张志峰 on 2016/10/30.
//  Copyright © 2016年 zhifenx. All rights reserved.
//

#import "MHNearByHomeHeaderCollectionViewCell.h"

@interface MHNearByHomeHeaderCollectionViewCell ()


@property (nonatomic, strong) UILabel *titleLabel;

@end

@implementation MHNearByHomeHeaderCollectionViewCell


- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        UIImageView *iconView = [[UIImageView alloc] init];
        [self addSubview:iconView];
        UILabel *titleLabel = [[UILabel alloc] init];
        titleLabel.textAlignment = NSTextAlignmentCenter;
        titleLabel.font = [UIFont systemFontOfSize:12.0];
        titleLabel.textColor = MHTextColor333;
        
        UILabel *distance = [[UILabel alloc] init];
        distance.textAlignment = NSTextAlignmentCenter;
        distance.font = [UIFont systemFontOfSize:12.0];
        distance.textColor = [UIColor grayColor];
        [self addSubview:distance];
        self.distanceLabel = distance;
        self.iconView = iconView;
        self.titleLabel = titleLabel;
        [self addSubview:self.titleLabel];
    }
    return self;
}


- (void)setTitle:(NSString *)title {
    _title = title;
    self.titleLabel.text = title;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    self.iconView.frame = CGRectMake((self.width - 50) / 2, 5, 50 , 50);
    self.iconView.cornerRadius = self.iconView.width / 2;
//    self.iconView.centerX = self.centerX;
    self.iconView.masksToBounds = YES;
    self.titleLabel.frame = CGRectMake(0, CGRectGetMaxY(self.iconView.frame) + 5, self.frame.size.width, 21);
    self.distanceLabel.frame = CGRectMake(0, CGRectGetMaxY(self.titleLabel.frame), self.frame.size.width, 20);
}

@end
